package com.wuhenzhizao.sku.bean;

import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

/**
 * 商品属性Bean类
 *
 * @author wuhenzhizao
 * @since 2017-08-02
 */
public class SkuAttribute implements Sequenceable {
    /**
     * 反序列化
     */
    public static final Sequenceable.Producer<SkuAttribute> CREATOR = new Sequenceable.Producer<SkuAttribute>() {
        @Override
        public SkuAttribute createFromParcel(Parcel in) {
            SkuAttribute skuAttribute = new SkuAttribute();
            skuAttribute.unmarshalling(in);
            return skuAttribute;
        }
    };

    private String key;
    private String value;

    /**
     * 构造
     */
    public SkuAttribute() {
    }

    /**
     * 构造
     *
     * @param key
     * @param value
     */
    public SkuAttribute(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "SkuAttribute{"
                + "key='" + key + '\''
                + ", value='" + value + '\''
                + '}';
    }

    @Override
    public boolean marshalling(Parcel dest) {
        return dest.writeString(this.key) && dest.writeString(this.value);
    }

    @Override
    public boolean unmarshalling(Parcel in) {
        this.key = in.readString();
        this.value = in.readString();
        return true;
    }
}
